<!DOCTYPE html>
<html lang="en" xmlns:zxw="http://www.w3school.com.cn" xmlns:njzxw="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>首页</title>
    <link rel="stylesheet" href="../../../js/common/layui/css/layui.css">
    <link rel="stylesheet" href="../../../css/common/animate.css"/>
    <link rel="stylesheet" href="../../../css/common/common.css"/>
    <style type="text/css">
        .layui-upload-drag img {
            width: 100px;
            height: 100px;
        }

        .layui-field-title {
            border-width: 1px;
            padding: 10px;
            border-radius: 5px;
        }
    </style>
</head>
<body class="layout-zxw layout-zxw-add">

<form action="" id="form1" class="layui-form" lay-filter="form1">
    <input type="hidden" id="id" name="id" value="">
    <div class="layui-row ">
        <zxw:input id="groupname" type="text" parcel="true" placeholder="请输入类型名称" parcelName="类型名称" inline="true"
                   value="" maxlength="10" name="groupname" lay_verify="required"></zxw:input>
        <zxw:input id="groupcode" type="text" parcel="true" placeholder="请输入类型编码" parcelName="类型编码" inline="true"
                   value="" maxlength="10" name="groupcode" lay_verify="required"></zxw:input>
    </div>
    <div class="layui-row">
        <zxw:switch id="init" name="init" parcel="true" inline="true" text="是|否" remark="是否系统初始化"
                    parcelName="是否系统初始化"></zxw:switch>
        <zxw:switch id="siglesubitem" name="siglesubitem" change="siglesubitem_change" parcel="true" inline="true"
                    text="是|否" remark="是否多项参数值" parcelName="是否多项参数"></zxw:switch>
    </div>
    <div class="layui-row item_num_div">
        <zxw:switch id="is_add_item" name="is_add_item" parcel="true" inline="true" text="是|否" remark="是否允许添加项"
                    parcelName="是否允许添加项"></zxw:switch>
        <zxw:input id="item_num" type="text" parcel="true" placeholder="请输入初始化参数数量" parcelName="参数数量"
                   parcelclass="col-xs-4" inline="true" value="1" maxlength="10" name="item_num"
                   lay_verify="number"></zxw:input>
    </div>
    <div class="layui-row">
        <zxw:switch id="weixinxcx" name="weixinxcx" parcel="true" inline="true" text="是|否" remark="微信小程序是否初始化加载"
                    parcelName="小程序初始化"></zxw:switch>
        <zxw:switch id="is_reload" name="is_reload" parcel="true" inline="true" text="是|否" remark="参数值改变是否需要重启"
                    parcelName="是否需要重启"></zxw:switch>
        <zxw:switch id="is_app" name="is_app" parcel="true" inline="true" text="是|否" remark="app是否初始化加载"
                    parcelName="app初始化"></zxw:switch>
    </div>
    <div class="layui-row">
        <zxw:textarea rich="true" height="400px" id="remark" type="text" parcel="true" placeholder="请输入备注"
                      parcelName="备注" parcelclass="col-xs-12" inline="false" value="" maxlength="10" name="remark"
                      lay_verify=""></zxw:textarea>
    </div>

</form>

<script type="application/javascript" src="../../../js/common/own/own.js?layui,jquery,njzxw,URL">
    njzxw.layui.val({
        url: URL.ITEM.GETBIGMAP,
        param_name: 'groupcode',
        fun: function (data) {
            if (!$.isEmptyObject(data) && data.is_add_item == 1) {
                $('.item_num_div').show();
            } else {
                $('.item_num_div').hide();
            }
            if (!$.isEmptyObject(data)) {
                $('#id').val(data.id);
            }
        }
    });
    njzxw.layui.submit({
        url: URL.ITEM.SAVEBIG,
        prepFun: function (data) {
            data.id = $('#id').val();
            return data;
        }
    });

    function siglesubitem_change(obj) {
        $('#item_num').val(1);
        layui.form.val("form1", {
            "is_add_item": false
        });
        if (obj) {
            $('.item_num_div').show();
        } else {
            $('.item_num_div').hide();
        }
    }

</script>
</body>
</html>